package com.practice.java8.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.Stack;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class ConvertMain {

	public static void main(String[] args) {
		Stream<String> stream = Stream.of("a", "b", "c");
		convertStream(stream);
	}
	
	public static void convertStream(Stream<String> stream) {
		// 1. Array
		String[] strArray1 = stream.toArray(String[]::new);
		// 2. Collection
		List<String> list1 = stream.collect(Collectors.toList());
		List<String> list2 = stream.collect(Collectors.toCollection(ArrayList::new));
		Set set1 = stream.collect(Collectors.toSet());
		Stack stack1 = stream.collect(Collectors.toCollection(Stack::new));
		// 3. String
		String str = stream.collect(Collectors.joining()).toString();
	}

}
